<script type="text/javascript" src="{$smarty.const.BASE_URL}/external/yui/build/yuiloader-dom-event/yuiloader-dom-event.js"></script>
<link rel="stylesheet" type="text/css" href="{$smarty.const.BASE_URL}/modules/duanmodule/css/duanmodule.css" />
<div class="duanmodule manager">
    {permissions level=$smarty.const.UILEVEL_NORMAL}
    {if $permissions.edit == 1 || $permissions.delete == 1}
    <div class="itemactions">
        {if $permissions.edit == 1}
        <a href="{link action=edit id=$project->id}"><img class="mngmnt_icon" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" /></a>
        {/if}
        {if $permissions.delete == 1}
        <a href="{link action=delete id=$project->id}"><img class="mngmnt_icon" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" onclick="return confirm('{$_TR.delete_link_confirm}');" /></a>
        {/if}
    </div>
    {/if}
    {/permissions}
    <div class="project_header">
        {if $project->featured == 1}
            <div class="wapper">
                <div class="project_name">{$project->name}</div>
                <div class="project_location">{$project->location}</div>
            </div>
            <div class="featured">{$_TR.featured}</div>
        {else}
            <div class="project_name">{$project->name}</div>
            <div class="project_location">{$project->location}</div>
            <br>
        {/if}
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
    <div id="nav-tabs" class="yui-navset">
        <ul class="yui-nav" id="duan_ul">
            {if $project->bigimage_path != ''}
            <li><a href="#tong_quan"><em>{$_TR.tong_quan}</em></a></li>
            {/if}
            {if $project->tongquan != ''}
            <li><a href="#gioi_thieu"><em>{$_TR.gioi_thieu}</em></a></li>
            {/if}
            {if $project->hatang_dichvu != ''}
            <li><a href="#hatang_dichvu"><em>{$_TR.hatang_dichvu}</em></a></li>
            {/if}
            {if $project->vitri_chitiet != ''}
            <li><a href="#vi_tri"><em>{$_TR.vi_tri}</em></a></li>
            {/if}
            {if $project->ttthem_sodomatbang != ''}
            <li><a href="#sodo_matbang"><em>{$_TR.so_do_mat_bang}</em></a></li>
            {/if}
            {if $project->ttthem_maunha != ''}
            <li><a href="#mau_nha"><em>{$_TR.mau_nha}</em></a></li>
            {/if}
            {if $project->ttthem_thanhtoan != ''}
            <li><a href="#thanh_toan"><em>{$_TR.thanh_toan}</em></a></li>
            {/if}
        </ul>            
        <div class="yui-content">
            {if $project->bigimage_path != ''}
            <div id="gioi_thieu">
                <div class="big_image"><a rel='lightbox' href="{$project->bigimage_path}" title="{$project->name} - {$project->location}"><img src="{$smarty.const.BASE_URL}/phpThumb.php?src={$project->bigimage_path}&w=646" alt="{$project->name}"></a></div>
            </div>
            {/if}
            {if $project->tongquan != ''}
            <div id="tong_quan">
                {$project->tongquan}
            </div>
            {/if}
            {if $project->hatang_dichvu != ''}
            <div id="hatang_dichvu">
                {$project->hatang_dichvu}
            </div>
            {/if}
            {if $project->vitri_chitiet != ''}
            <div id="vi_tri">
                <h1>{$_TR.vi_tri_title}</h1>
                {*Map*}
                <div class="map" >
                    <img width="640" height="640" id="staticmap" 
        src="http://maps.google.com/maps/api/staticmap?markers=color:green|{$project->vitri_lat},{$project->vitri_long}&key={$config->map_key}&size=640x640&sensor=false">
                </div>
                {*Map detail*}
                <div>
                    {$project->vitri_chitiet}
                </div>
            </div>
            {/if}
            {if $project->ttthem_sodomatbang != ''}
            <div id="sodo_matbang">
                {$project->ttthem_sodomatbang}
            </div>
            {/if}
            {if $project->ttthem_maunha != ''}
            <div id="mau_nha">
                <div class="form_header">
                    <p>{$_TR.please_click_on_image_to_view}</p>
                </div>
                {$project->ttthem_maunha}
            </div>
            {/if}
            {if $project->ttthem_thanhtoan != ''}
            <div id="thanh_toan">
                {$project->ttthem_thanhtoan}
            </div>
            {/if}
        </div>
    </div>
</div>

{literal}
<script language='javascript'>
// move to right tab when user pass URL within anchor
jQuery(document).ready(function(){
   var myFile = document.location.toString();
   if (myFile.match('#')) { // the URL contains an anchor
    // click the navigation item corresponding to the anchor
    var myAnchor = '#' + myFile.split('#')[1];
    jQuery('#duan_ul li > a[href="'+myAnchor+'"]').parent().addClass("selected");
   } else {
    // click the first navigation item
    jQuery('#duan_ul li:first').addClass("selected");
   } 
});
</script>
{/literal}

{script yuimodules="'tabview'" unique="managenavtabs"}
    {literal}var tabView = new YAHOO.widget.TabView('nav-tabs');{/literal}
{/script}

{* For featured project in current province *}
{chain action='featuredlist' module='duanmodule' load_css=0 src=$__loc->src}
{*include file="`$smarty.const.BASE`/modules/duanmodule/views/_view_detail_featured.tpl"*}